package com.liangxy.news.model;

/**
 * 广告轮播数据模型
 */
public class AdBanner {
    private String imageUrl;
    private String title;
    private String link;
    private int localImageResId; // 本地图片资源ID
    private int layoutResId; // 布局资源ID

    // 空构造函数
    public AdBanner() {
    }

    // 网络图片构造函数
    public AdBanner(String imageUrl, String title, String link) {
        this.imageUrl = imageUrl;
        this.title = title;
        this.link = link;
    }

    // 本地图片构造函数
    public AdBanner(int imageResId, String title, String link, boolean isImage) {
        if (isImage) {
            this.localImageResId = imageResId;
        } else {
            this.layoutResId = imageResId;
        }
        this.title = title;
        this.link = link;
    }
    
    // 创建本地图片实例的静态工厂方法
    public static AdBanner createWithImage(int imageResId, String title, String link) {
        AdBanner banner = new AdBanner();
        banner.localImageResId = imageResId;
        banner.title = title;
        banner.link = link;
        return banner;
    }
    
    // 创建布局实例的静态工厂方法
    public static AdBanner createWithLayout(int layoutResId, String title, String link) {
        AdBanner banner = new AdBanner();
        banner.layoutResId = layoutResId;
        banner.title = title;
        banner.link = link;
        return banner;
    }

    // Getters and Setters
    public String getImageUrl() {
        return imageUrl;
    }

    public void setImageUrl(String imageUrl) {
        this.imageUrl = imageUrl;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getLink() {
        return link;
    }

    public void setLink(String link) {
        this.link = link;
    }

    public int getLocalImageResId() {
        return localImageResId;
    }

    public void setLocalImageResId(int localImageResId) {
        this.localImageResId = localImageResId;
    }
    
    public int getLayoutResId() {
        return layoutResId;
    }
    
    public void setLayoutResId(int layoutResId) {
        this.layoutResId = layoutResId;
    }

    public boolean isLocalImage() {
        return localImageResId != 0;
    }
    
    public boolean isCustomLayout() {
        return layoutResId != 0;
    }
} 